import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
// import { rules } from '/@/utils/helper/validator';
// import { render } from '/@/utils/common/renderUtils';

export const columns: BasicColumn[] = [
  {
    title: 'ID',
    dataIndex: 'id',
  },
  // {
  //   title: '编码',
  //   dataIndex: 'code',
  // },
  {
    title: '名称',
    dataIndex: 'name',
  },
  {
    title: '简称',
    dataIndex: 'shortName',
  },
  {
    title: '性质',
    dataIndex: 'classify',
  },
  {
    title: '省份',
    dataIndex: 'province',
  },
  {
    title: '城市',
    dataIndex: 'city',
  },
  {
    title: '区县',
    dataIndex: 'county',
  },
  {
    title: '地址',
    dataIndex: 'address',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '性质',
    field: 'classify',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'terminalClassify',
    },
  },
];

export const formSchema: FormSchema[] = [
  // TODO 主键隐藏字段，目前写死为ID
  { label: '', field: 'id', component: 'Input', show: false },
  { label: '', field: 'typeId', component: 'Input', show: false, defaultValue: '000001395019' },
  {
    label: '编码',
    field: 'code',
    component: 'Input',
    show: ({ values }) => {
      return !!values.id;
    },
    dynamicDisabled: ({ values }) => {
      return !!values.id;
    },
  },
  {
    label: '名称',
    field: 'name',
    required: true,
    component: 'Input',
  },
  {
    label: '简称',
    field: 'shortName',
    component: 'Input',
  },
  {
    label: '性质',
    field: 'classify',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'terminalClassify',
    },
  },
  {
    label: '地址',
    field: 'address',
    component: 'Input',
  },
  {
    field: 'regionDetail',
    component: 'JAreaLinkage',
    label: '区域',
    required: true,
    defaultValue: [],
  },
];
